import mongoose, { Schema,Document } from 'mongoose'

export interface IUser extends Document {
    username: string,
    password: string,
    gender?: number,
    age?: number,
    phone?: string,
    address?: string[],
    hobby?: string[]
    status?: number
    authCode?: string
}

const UserSchema:Schema = new Schema({
    username: {
        type: String,
        unique: true,
        require: true
    },
    password: { type: String, require: true },
    gender: {type: Number, default: 1},
    age: {type: Number},
    phone: {type: String},
    address: {type: [String]},
    hobby: {type: [String]},
    status: {type: Number, default: 0},
    authCode: {type: String}
})

export default mongoose.model<IUser>('User', UserSchema)
